#include <stdio.h>

int main(){

    FILE *fp;
    fp = fopen("./test.txt", "r+");

    char x;
    while(fread(&x, sizeof(char), 1, fp) == 1){
        printf("%d\n", x);
        if(x == '3'){
            printf("find data %c, change to 6\n", x);
            fseek(fp, -(long)sizeof(char), 1);
            x = '6';
            fwrite(&x, sizeof(char), 1, fp);
            fseek(fp, 0, 1);
        }
    }

    printf("end\n");

    

    return 0;
}